//
//  ChoiceButton.m
//  CarCare
//
//  Created by ileo on 14-8-12.
//  Copyright (c) 2014年 baozun. All rights reserved.
//

#import "ChoiceButton.h"

@interface ChoiceButton()

@property (nonatomic, strong) UIImageView *choiceV;

@end

@implementation ChoiceButton

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.choice = YES;
        
        self.layer.borderColor = [UIColor lightGrayColor].CGColor;
        self.layer.borderWidth = 0.5;
        
        self.showsTouchWhenHighlighted = YES;
        [self addTarget:self action:@selector(clickOnSelf:) forControlEvents:UIControlEventTouchUpInside];
        
        self.choiceV = [Factory imageViewWithCenter:CGPointMake(self.width/2, self.height/2) image:ImageNamed(@"yes.png") onView:self];
        
    }
    return self;
}

-(void)clickOnSelf:(id)sender{
    self.choiceV.hidden = self.choice;
    self.choice = !self.choice;
}

// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
    
}

@end
